// import com.alibaba.druid.sql.SQLUtils;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLIndexDefinition;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
// import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
// import com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.List;
#pragma once

#include <string>
#include <list>

#include "../SQLExpr.h"
#include "../SQLExprImpl.h"
#include "../Object.h"
#include "../SQLIndexDefinition.h"

#include "SQLTableElement.h"
#include "SQLUniqueConstraint.h"
#include "SQLConstraintImpl.h"

// #include "../../visitor/SQLASTVisitor.h"
class SQLASTVisitor;
class SQLSelectOrderByItem;
class SQLColumnDefinition;

class SQLUnique 
: virtual public SQLConstraintImpl,
 virtual public SQLUniqueConstraint, 
 virtual public SQLTableElement
{
public:
  SQLIndexDefinition_ptr indexDefinition;

  SQLUnique();
  SHAREDOBJECT(SQLUnique);

  // Override name and comment in constraint impl.

  SQLName_ptr getName();

  void setName(SQLName_ptr name);

  void setName(string_ptr  name);

  SQLExpr_ptr getComment();

  void setComment(SQLExpr_ptr x);

  SQLIndexDefinition_ptr getIndexDefinition();

  SQLSelectOrderByItem_list_ptr getColumns();

  void addColumn(SQLExpr_ptr column);

  void addColumn(SQLSelectOrderByItem_ptr column);

  void accept0(SQLASTVisitor_ptr  visitor) override;

  BOOL_ptr containsColumn(string_ptr  column);

  BOOL_ptr containsColumn(long columnNameHash);

  void cloneTo(SQLUnique_ptr x);

  // SQLUnique *clone();
  virtual SQLObject_ptr clone();
  void simplify();

  BOOL_ptr applyColumnRename(SQLName_ptr  columnName, SQLColumnDefinition* to) ;

  BOOL_ptr applyDropColumn(SQLName_ptr columnName);

  SQLName_list_ptr  getCovering();
};
